package com.kyrioscraft.cloud.security.thirdpartylogin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.social.connect.web.ProviderSignInUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.ServletWebRequest;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author kyrioscraft
 * @Date 2018/12/29 14:10
 * @Description //TODO
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private ProviderSignInUtils providerSignInUtils;

    @PostMapping("/regist")
    public void regist(HttpServletRequest request){

        //用户注册生成的userId
        String userId = "123";
        providerSignInUtils.doPostSignUp(userId,new ServletWebRequest((request)));
    }
}
